]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tests/unit: Access shell sources from resource
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 10 Aug 2023 15:50:08 +0000 (17:50 +0200)
committerMarge Bot <marge-bot@gnome.org>
Thu, 10 Aug 2023 17:42:23 +0000 (17:42 +0000)
Unit tests currently load shell sources directly from the
filesystem.

This is currently blocking generated sources - namely config.js - to
ESM, because a relative import from the source dir will fail to
locate the file in the build dir.

Address this by using the same GResource as gnome-shell instead of
direct filesystem access, as the resource will always include all
sources files at the expected location.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2880>

src/meson.build
tests/unit/highlighter.js
tests/unit/injectionManager.js
tests/unit/insertSorted.js
tests/unit/jsParse.js
tests/unit/markup.js
tests/unit/params.js
tests/unit/signalTracker.js
tests/unit/url.js
tests/unit/versionCompare.js

index 3e18aad9363a1ca65d97cb518de5c03e69f4286f..50d89b16e07f4d0b0bd811277501c04d4de1ffc2 100644 (file)
@@ -263,7 +263,7 @@ if have_networkmanager
   )
 endif
 
-executable('gnome-shell-perf-helper', 'shell-perf-helper.c',
+executable('gnome-shell-perf-helper', 'shell-perf-helper.c', js_resources,
   dependencies: [gtk_dep, gio_dep, m_dep],
   include_directories: [conf_inc],
   install_dir: libexecdir,
index 2bd64c1782a3877ddf0f53bd5cfee25bac1e1fa0..3c0d3f188e1a37c89a15804857775abebb280171 100644 (file)
@@ -5,8 +5,8 @@
 const JsUnit = imports.jsUnit;
 import Pango from 'gi://Pango';
 
-import '../../js/ui/environment.js';
-import * as Util from '../../js/misc/util.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
+import * as Util from 'resource:///org/gnome/shell/misc/util.js';
 
 const tests = [
     {
index e727f35e97400737185e8c4f5ce68030a66682fe..2cedd8086fd608b00edd9c7a5b4bd304788f75bd 100644 (file)
@@ -2,9 +2,9 @@ const JsUnit = imports.jsUnit;
 
 import GObject from 'gi://GObject';
 
-import '../../js/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
 
-import {InjectionManager} from '../../js/extensions/extension.js';
+import {InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
 
 class Object1 {
     count = 0;
index 35131e60fb960af84154de3cc0fb914d7862e0bf..ec7e2095f8d399f0b2304d97a20d7b6dabfc4fc1 100644 (file)
@@ -4,11 +4,11 @@
 
 // Needed so that Util can bring some UI stuff
 // we don't actually use
-import '../../js/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
 
 import * as Assertions from '../common/assertions.js';
 
-import * as Util from '../../js/misc/util.js';
+import * as Util from 'resource:///org/gnome/shell/misc/util.js';
 
 let arrayInt = [1, 2, 3, 5, 6];
 Util.insertSorted(arrayInt, 4, (one, two) => one - two);
index bc5dd73b504db9d7d7c746af8717a041fb989518..9dac85c1960439e5dc0ead1e5ebf7561d3bff83e 100644 (file)
@@ -4,11 +4,11 @@
 
 const JsUnit = imports.jsUnit;
 
-import '../../js/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
 
 import * as Assertions from '../common/assertions.js';
 
-import * as JsParse from '../../js/misc/jsParse.js';
+import * as JsParse from 'resource:///org/gnome/shell/misc/jsParse.js';
 
 const HARNESS_COMMAND_HEADER = 'let imports = obj;' +
                                'let global = obj;' +
index 846a886f29e2b790a53ea522d31af355c21bbffd..885b213a2fffe63bc375c43934188fd64eca36b6 100644 (file)
@@ -5,10 +5,10 @@
 const JsUnit = imports.jsUnit;
 import Pango from 'gi://Pango';
 
-import '../../js/ui/environment.js';
-import '../../js/ui/main.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/main.js';
 
-import * as MessageList from '../../js/ui/messageList.js';
+import * as MessageList from 'resource:///org/gnome/shell/ui/messageList.js';
 
 /**
  * Assert that `input`, assumed to be markup, gets "fixed" to `output`,
index b297dfce60f7ec9b84d59266365cdc7bb5a58daf..2edb019d123410630c5a66a76d8ef8ab271617da 100644 (file)
@@ -1,5 +1,5 @@
 const JsUnit = imports.jsUnit;
-import * as Params from '../../js/misc/params.js';
+import * as Params from 'resource:///org/gnome/shell/misc/params.js';
 
 /**
  * Asserts that two "param" objects have the same properties
index 99c16a084aec910f36d76468def7b485abbfd3d7..dc1146852ecc8253ac56c509ebfb012c40dea59a 100644 (file)
@@ -2,13 +2,13 @@
 
 // Test cases for version comparison
 
-import '../../js/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
 import GObject from 'gi://GObject';
 
 const JsUnit = imports.jsUnit;
-import * as Signals from '../../js/misc/signals.js';
+import * as Signals from 'resource:///org/gnome/shell/misc/signals.js';
 
-import {TransientSignalHolder, registerDestroyableType} from '../../js/misc/signalTracker.js';
+import {TransientSignalHolder, registerDestroyableType} from 'resource:///org/gnome/shell/misc/signalTracker.js';
 
 const Destroyable = GObject.registerClass({
     Signals: {'destroy': {}},
index 7a72f8f2b0981fc5eeee2b9e814b9c348a88a7bf..00ad66dcbe6d341156ca85889c3a7b8389c45460 100644 (file)
@@ -4,9 +4,9 @@
 
 const JsUnit = imports.jsUnit;
 
-import '../../js/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
 
-import * as Util from '../../js/misc/util.js';
+import * as Util from 'resource:///org/gnome/shell/misc/util.js';
 
 const tests = [
     {
index 0ce43d0e77d0ddcd31646238c0b0d2bb4677dad4..549afeecd45d00417050f77d2e104c91757e100e 100644 (file)
@@ -4,9 +4,9 @@
 
 const JsUnit = imports.jsUnit;
 
-import '../../js/ui/environment.js';
+import 'resource:///org/gnome/shell/ui/environment.js';
 
-import * as Util from '../../js/misc/util.js';
+import * as Util from 'resource:///org/gnome/shell/misc/util.js';
 
 const tests = [
     {